package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JSeparator;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class frmingrediente extends javax.swing.JFrame {
	private JLabel lbldatosingrediente;
	private JLabel lblstockminimo;
	private JLabel lblcostounitario2;
	private JButton btnsalir;
	private JButton btncancelar;
	private JButton btnguardar;
	private JSeparator sp;
	private JTextField txtstockminimo;
	private JTextField txtcostounitario;
	private JLabel lblcostounitario;
	private JComboBox cmbunidad;
	private JLabel lblunidad;
	private JTextField txtexistencia;
	private JLabel lblexistencia;
	private JTextField txtnombreingrediente;
	private JLabel lblnombreingrediente;
	private JTextField txtcodigoingrediente;
	private JLabel lblcodigoingrediente;
	private static final String[] TIPOUNIDAD = {"UNIDAD", "KG"};
	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				frmingrediente inst = new frmingrediente();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public frmingrediente() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Registrar Ingrediente");
			getContentPane().setLayout(null);
			{
				lbldatosingrediente = new JLabel();
				getContentPane().add(lbldatosingrediente);
				lbldatosingrediente.setText("Datos del Ingrediente");
				lbldatosingrediente.setBounds(30, 17, 137, 24);
				lbldatosingrediente.setFont(new java.awt.Font("Segoe UI",1,12));
			}
			{
				lblcodigoingrediente = new JLabel();
				getContentPane().add(lblcodigoingrediente);
				lblcodigoingrediente.setText("Codigo :");
				lblcodigoingrediente.setBounds(30, 53, 148, 16);
			}
			{
				txtcodigoingrediente = new JTextField();
				getContentPane().add(txtcodigoingrediente);
				txtcodigoingrediente.setBounds(92, 50, 76, 23);
			}
			{
				lblnombreingrediente = new JLabel();
				getContentPane().add(lblnombreingrediente);
				lblnombreingrediente.setText("Nombre :");
				lblnombreingrediente.setBounds(30, 92, 50, 16);
			}
			{
				txtnombreingrediente = new JTextField();
				getContentPane().add(txtnombreingrediente);
				txtnombreingrediente.setBounds(92, 89, 132, 23);
			}
			{
				lblexistencia = new JLabel();
				getContentPane().add(lblexistencia);
				lblexistencia.setBounds(30, 142, 90, 10);
				lblexistencia.setText("Existencia :");
			}
			{
				txtexistencia = new JTextField();
				getContentPane().add(txtexistencia);
				txtexistencia.setBounds(94, 136, 48, 23);
			}
			{
				lblunidad = new JLabel();
				getContentPane().add(lblunidad);
				lblunidad.setText("Unidad :");
				lblunidad.setBounds(160, 139, 64, 16);
			}
			{
				ComboBoxModel cmbunidadModel = 
					new DefaultComboBoxModel(
							new String[] { "UNIDAD", "KG" });
				cmbunidad = new JComboBox();
				getContentPane().add(cmbunidad);
				cmbunidad.setModel(cmbunidadModel);
				cmbunidad.setBounds(224, 135, 74, 24);
			}
			{
				lblcostounitario = new JLabel();
				getContentPane().add(lblcostounitario);
				lblcostounitario.setText("Costo Unitario :");
				lblcostounitario.setBounds(30, 173, 108, 16);
			}
			{
				txtcostounitario = new JTextField();
				getContentPane().add(txtcostounitario);
				txtcostounitario.setBounds(125, 170, 49, 23);
			}
			{
				lblcostounitario2 = new JLabel();
				getContentPane().add(lblcostounitario2);
				lblcostounitario2.setText("BsF.");
				lblcostounitario2.setBounds(180, 173, 36, 16);
			}
			{
				lblstockminimo = new JLabel();
				getContentPane().add(lblstockminimo);
				lblstockminimo.setText("Stock Minimo :");
				lblstockminimo.setBounds(212, 173, 104, 16);
			}
			{
				txtstockminimo = new JTextField();
				getContentPane().add(txtstockminimo);
				txtstockminimo.setBounds(300, 173, 61, 23);
			}
			{
				sp = new JSeparator();
				getContentPane().add(sp);
				sp.setBounds(0, 208, 384, 10);
			}
			{
				btnguardar = new JButton();
				getContentPane().add(btnguardar);
				btnguardar.setText("Guardar");
				btnguardar.setBounds(24, 228, 85, 22);
			}
			{
				btncancelar = new JButton();
				getContentPane().add(btncancelar);
				btncancelar.setText("Cancelar");
				btncancelar.setBounds(157, 227, 89, 23);
			}
			{
				btnsalir = new JButton();
				getContentPane().add(btnsalir);
				btnsalir.setText("Salir");
				btnsalir.setBounds(287, 227, 74, 23);
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	public void addListener(ActionListener actionListener) {
		btnguardar.addActionListener(actionListener);
		btncancelar.addActionListener(actionListener);
		btnsalir.addActionListener(actionListener);
	}

	public void mostrarMensaje(String mensaje) {
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	public String getcodigoingrediente() {
		return txtcodigoingrediente.getText();
	}

	public String getnombreingrediente() {
		return txtnombreingrediente.getText();
	}
	public String getcostounitario() {
		return txtcostounitario.getText();
	}
	public String getexistencia() {
		return txtexistencia.getText();
	}
	public String getstockmin(){
		return txtstockminimo.getText();
	}
	public String getunidad(){
		return cmbunidad.getSelectedItem().toString();
	}
	public void borrarDatos()
	{
		txtcodigoingrediente.setText("");
		txtnombreingrediente.setText("");
		txtcostounitario.setText("");
		txtexistencia.setText("");
		txtstockminimo.setText("");
				
	}
	
}
